<!DOCTYPE html>
<html lang="en">
<head>
    {include file='public/meta'/}
    <style>
        .table th, .table td {
            text-align: left;
        }

        .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
            vertical-align: middle;
        }
        .info-row{
            line-height: 54px;
            color: #333;
        }
        .info-row label{
            font-weight: 400;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section id="content">
    {include file='public/left'/}
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ol class="breadcrumb">
                <li>当前位置是：</li>
                <li><a href="javascript:history.back();">粉丝管理</a></li>
                <li class="active" style="color: #02b87f;">粉丝列表</li>
            </ol>
        </div>
        <div class="panel panel-default mgl15 mgr15">
            <div class="panel-heading"><h5 class="panel-title">粉丝列表</h5></div>
            <div class="panel-body">
                <div>
                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs" role="tablist">
                        <li role="presentation" class="active">
                            <a href="#home" aria-controls="home" role="tab" data-toggle="tab">基本信息</a>
                        </li>
                        <li role="presentation">
                            <a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">投放会员卡/卡券</a>
                        </li>
                    </ul>
                    <!-- Tab panes -->
                    <div class="tab-content">
                        <div role="tabpanel" class="tab-pane active" id="home">
                            <div class="row info-row" id="templateHtml" style="margin-top: 15px;">
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">昵称：</label>
                                    <div class="col-xs-8 ng-binding">{$info['nickname']}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right">头像：</label>
                                    <div class="col-xs-8">
                                        {if condition="$info['head_url'] neq '' "}
                                        <img src="{$info['head_url']}" style="width: 48px;height: 48px;" alt="头像">
                                        {else/}
                                        <img style="width: 48px;height: 48px;" src="__STATIC_URL__/static/images/fensi.jpg" alt="">
                                        {/if}
                                    </div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">性别：</label>
                                    <div class="col-xs-8 ng-binding">{:get_wx_sex($info['sex'])}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">电话：</label>
                                    <div class="col-xs-8">{$info['phone']}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">地区/城市：</label>
                                    <div class="col-xs-8">{$info['city']}</div>
                                </div>
                                <div class="col-xs-6 ng-scope">
                                    <label class="col-xs-4 text-right ng-binding">备注：</label>
                                    <div class="col-xs-8">{$info['remark']}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">分组：</label>
                                    <div class="col-xs-8">{$info['group']}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">状态：</label>
                                    <div class="col-xs-8">
                                        {if condition="$info['statu'] eq '1' "}
                                        <span class="text-success">已关注</span>
                                        {else/}
                                        <span class="text-danger">未关注</span>
                                        {/if}
                                    </div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">关注时间：</label>
                                    <div class="col-xs-8">{$info['create_time']}</div>
                                </div>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="profile">
                            <form class="form-horizontal adminex-form" id="tfform" action="" method="post" style="margin-top: 15px;">
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 活动名称</label>
                                    <div class="col-sm-9 col-xs-12">
                                        <input type="hidden" class="form-control" name="nickname" value="{$info.nickname}">
                                        <input type="hidden" class="form-control" name="openid" value="{$info.openid}">
                                        <input type="text" class="form-control" name="rulename" id="rulename">
                                        <div class="help-block">活动名称只用于管理，不显示给用户。 </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 选择要投放的卡券</label>
                                    <div class="col-sm-9 col-xs-12">
                                        <select name="card_id" id="card_id" class="form-control" >
                                            <option value="">请选择</option>
                                            {volist name="cardus" id="vous"}
                                            <option value="{$vous.card_id}">{$vous.title}[会员卡]</option>
                                            {/volist}
                                            {volist name="cards" id="vos"}
                                            <option value="{$vos.card_id}">{$vos.title}[卡券]</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                                {if condition="checkPath('marke/putCard')"}
                                <div style="text-align: center">
                                    <button type="button" class="btn btn-primary" onclick="addform()">添加</button>
                                </div>
                                {/if}
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<script>
    function addform() {
        var rulename = $("#rulename").val();
        var card_id = $("#card_id").val();
        if(rulename==""){
            layer.alert("请输入活动名称",{icon:7});
            return false;
        }
        if(card_id==""){
            layer.alert("请选择投放的卡券",{icon:7});
            return false;
        }
        $.ajax({
            url:"{:url('marke/putCard')}",
            type:"post",
            data:$("#tfform").serialize(),
            success:function(data){
                console.log(data)
                if(data.code==0){
                    layer.msg(data.message,{icon:1});
                    setTimeout("window.location.reload()",1000);
                    return false;
                }else{
                    layer.alert(data.message,{icon:7})
                    return false;
                }
            }
        })
    }
</script>
</body>
</html>